﻿namespace Origin2.Core
{
    /// <summary>
    /// Represents something that contains variables
    /// </summary>
    public interface IVariableContainer
    {
        /// <summary>
        /// Sets a variable (or adds it) in this IVariableContainer
        /// </summary>
        /// <param name="key"> The name of the variable to set/add </param>
        /// <param name="value"> The new value of the variable </param>
        void SetVariable(string key, object value);

        /// <summary>
        /// Gets a variable from this IVariableContainer
        /// </summary>
        /// <param name="key"> The name of the variable to get </param>
        /// <returns> The found variable </returns>
        object GetVariable(string key);

        /// <summary>
        /// Gets a variable of the given type from this IVariableContainer
        /// </summary>
        /// <typeparam name="TVariableType"> The Type of variable to get </typeparam>
        /// <param name="key"> The name of the variable to get </param>
        /// <returns> The found variable </returns>
        TVariableType GetVariable<TVariableType>(string key);

        /// <summary>
        /// Removes a variable from this IVariableContainer
        /// </summary>
        /// <param name="key"></param>
        void RemoveVariable(string key);

        /// <summary>
        /// Gets whether there is a variable with the given name in this IVariableContainer
        /// </summary>
        /// <param name="key"> The name of the variable to search for </param>
        /// <returns> Whether there is a variable with the given name in this IVariableContainer </returns>
        bool ContainsVariable(string key);

        /// <summary>
        /// Gets whether the given object is contained in this IVariableContainer
        /// </summary>
        /// <param name="value"> The object to search for </param>
        /// <returns> Whether the given object is contained in this IVariableContainer </returns>
        bool ContainsVariable(object value);
    }
}
